
#ifndef _Player_H_
#define _Player_H_

#include "Utils/Vector2D.h"
#include "Ship.h"

#include <string>
#include <SDL/SDL.h>
#include <cassert>
#include <iostream>


enum PlayerType {
    HUMAN_PLAYER,
    AI_PLAYER,
};

class Player {
  public:
    Player(unsigned player_id, std::string player_name, unsigned team_id);
    virtual ~Player();

    // Update all of the player state, ie: control the ship.
    virtual void update(void) = 0;
    
    virtual PlayerType getPlayerType(void) = 0;

    void incrementScore(int amount);

    unsigned getScore(void) const;
    std::string getName(void) const;
    Ship* getShip(void) const;
    unsigned getTeamId(void) const;
    int getShotsFired(void) const;
    int getShotsHit(void) const;

    Vector2D getFocusPoint(void) const;

    void incShotsFired(void);
    void incShotsHit(void);
    
  protected:

    unsigned player_id;
    std::string name;
    WorldObjectPointer my_ship_ref;
    int score;
    unsigned team_id;
    
    // Some statistics to keep track of accuracy and such.
    int total_shots_fired;
    int total_shots_hit;

    mutable Vector2D last_gaze_point;
    unsigned last_alive_tick;


    bool amAlive(void) const;
    void checkHealth(void);
    void spawnNewShip(void);    
};

#endif

